//
//  LGMenuTextFiledView.m
//  ligenyun
//
//  Created by Mac on 2018/3/27.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGMenuTextFiledView.h"

@implementation LGMenuTextFiledView


- (instancetype)initWithFrame:(CGRect)frame leftTitle:(NSString *)leftTitle{
    if (self == [super initWithFrame:frame]) {
         self.titleLable.text = leftTitle;
        [self addSubview:self.titleLable];
        [self addSubview:self.textFiled];
       
    }
    return self;
}
#pragma mark --get
- (STLabel *)titleLable{
    if ((!_titleLable)) {
        _titleLable= [[STLabel alloc] initWithFrame:CGRectMake(0, 0, 80, 25)
                                                         text:@""
                                                    textColor:SecendTextColor
                                                         font:14
                                                  isSizetoFit:NO
                                                textAlignment:NSTextAlignmentRight];
        //[NSString lableAutoAdjustWitdhWithLabel:_titleLable];
        [self updateFrame];
    }
    return _titleLable;
}
- (UITextView *)textFiled{
    if (!_textFiled) {
        _textFiled = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 100, self.height - 10)];
        _textFiled.centerY = self.height / 2;
        [_textFiled st_setBorderWith:0.5 borderColor:TM_lineColor cornerRadius:0];
        [self updateFrame];
    }
    return _textFiled;
}
- (void)updateFrame{
    self.titleLable.left = 0;
    self.textFiled.left = self.titleLable.right + 10;
    self.textFiled.width = self.width - 10 - self.titleLable.right - 20;
    self.textFiled.top = self.titleLable.top + 5;
    
}
@end
